$(function(){
	var common = Common();
	
	//公共部分导入
	$('.nav').html(common.myNav);
	//线上出入金添加
	$('.goldin').html(common.golden);
	$('.foot').html(common.myfoot);
	common.goldControl();
	common.navControl('ljwm');
	common.closeFoot();
	
	var diaryList = [];
	
	var data = {
			"pid":41
		}
	
	common.jsonp(data,"jsonpReturn",function(res){
			if(res){
				diaryList = res;
				$.each(diaryList, function(i) {
					diaryList[i].addtime = common.nowtime(diaryList[i].addtime*1000,5);
				});
				$('.mylink1').attr('href',diaryList[0].url);
				$('.myDiaryImg1').attr('src',diaryList[0].img);
				$('.myDiaryTit1').text(diaryList[0].name);
				$('.myDiaryTime1').text(diaryList[0].addtime);
				$('.mylink2').attr('href',diaryList[1].url);
				$('.myDiaryImg2').attr('src',diaryList[1].img);
				$('.myDiaryTit2').text(diaryList[1].name);
				$('.myDiaryTime2').text(diaryList[1].addtime);
				$('.mylink3').attr('href',diaryList[2].url);
				$('.myDiaryImg3').attr('src',diaryList[2].img);
				$('.myDiaryTit3').text(diaryList[2].name);
				$('.myDiaryTime3').text(diaryList[2].addtime);
				$('.mylink4').attr('href',diaryList[3].url);
				$('.myDiaryImg4').attr('src',diaryList[3].img);
				$('.myDiaryTit4').text(diaryList[3].name);
				$('.myDiaryTime4').text(diaryList[3].addtime);
			}else{
				
			}
		},function(res){
			console.log('数据异常')
		})
	
	var sonSwiper = new Swiper('.swiper-container-v', {
		spaceBetween: 30,
        slidesPerView: 3,
        paginationClickable: true,
        speed: 300,
        freeMode: true,
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
   });
   
	 $('#myright').click(function(){
	   		sonSwiper.slideTo(sonSwiper.activeIndex+1);
	   })
	   
   $('#myleft').click(function(){
   		sonSwiper.slideTo(sonSwiper.activeIndex-1);
   })
	
	var num = 0;
	var mySwiper = new Swiper ('.swiper-container-h', {
        	direction: 'vertical',
        	touchMoveStopPropagation : false,
        	mousewheelControl : true, 
		    onSlideChangeEnd: function(swiper){
		    	$('.diaryBtn').removeClass('trans');
		    	process(swiper.activeIndex);
		    	var activePage = $(swiper.slides[swiper.activeIndex]);
	           
	            // 把表示页面里面所有需要做动画的元素的data-属性取出来，赋值给class，那么动画就运行起来了。
	            activePage.find(".animated").each(function(){
	            	
	            	$(this).removeClass('dis');
	            	
	                $(this).addClass($(this).data("animi"));
	                
	            });
	            
	            // 停止其他页面的动画。
	            activePage.siblings().find(".animated").each(function(){
	            	
	            	$(this).addClass('dis');
	                $(this).removeClass($(this).data("animi"));
	                
	            });
		  	} 
	  });	 
	  
	  
		$('.ysDataWrap').hover(function(){
			$(this).css('background-size','120%')
		},function(){
			$(this).css('background-size','100%')
		})
	  
	  	//动画控制类
	  	$(".CusAnimateDom").each(function () {
            var _delay = $(this).attr("data-delay");
            var _duration = $(this).attr("data-duration");
            $(this).css("-webkit-animation-delay", (_delay) + "ms");
            $(this).css("-webkit-animation-duration", (_duration) + "ms");
        });
        //边进程显示控制
        function process(num){
        	if(num>0){
        		$('.guideWrap').css("display","none");
        		$('.fixedTel').css('display','block');
        		$('.fixedWeixin').css('display','block');
        		$('.fixedDownLoad').css('display','block');
        		$('.gobackTop').css('display','block');
        	}else{
        		$('.fixedTel').css('display','none');
        		$('.fixedWeixin').css('display','none');
        		$('.fixedDownLoad').css('display','none');
        		$('.guideWrap').css("display","block");
        		$('.gobackTop').css('display','none');
        	}
        	$(".pointWrap").removeClass("circles");
        	$($(".pointWrap").eq(num)).addClass("circles");
        }
        
        
        $('.gobackTop').click(function(){
        	mySwiper.slideTo(0);
        })

        //安全保障按钮操作
        $('.businessBtns').hover(function(){
        	$(this).css('box-shadow','0px 0px 60px #f4ede2');
        },function(){
        	$(this).css('box-shadow','0px 0px 0px #f4ede2');
        })
        //河马日记按钮效果
        $('.diaryWrap').hover(function(){
      		$(this).css('box-shadow','0px 0px 60px #000');
      		$(this).css('z-index','15');
      		$(this).find('div').css('background-color','rgba(0,0,0,0)');
    
        },function(){
        	$(this).css('box-shadow','0px 0px 0px #000');
        	$(this).css('z-index','12');
        	$(this).find('div').css('background-color','rgba(0,0,0,0.4)');
        })
        //河马日记按钮效果
        $('.diaryBtn').hover(function(){
        	$('.diaryBtn').addClass('trans');
        	$('.diaryBtn').css('color','#dfbb87');
        	$('.diaryBtn').css('border','1px solid #efcb92');
        },function(){
        	$('.diaryBtn').css('color','white');
        	$('.diaryBtn').css('border','1px solid #fff');
        })
          //边侧栏控制器
		$('.fixedTel').hover(function(){
			$(this).addClass('fixedTelAc');
			$('.fixedTelTemp').css('display','block');
			$('.fixedTelTemp').animate({width:'146px'});
		},function(){
			$(this).removeClass('fixedTelAc');
			$('.fixedTelTemp').animate({width:'0px'},function(){
				$('.fixedTelTemp').css('display','none');
			});
		})

		$('.fixedWeixin').hover(function(){
			$(this).addClass('fixedWeixinOver');
			$('.fixedWeixinTemp').css('display','block');
			$('.fixedWeixinTemp').animate({width:'170px'});
		},function(){
			$(this).removeClass('fixedWeixinOver');
			$('.fixedWeixinTemp').animate({width:'0px'},function(){
				$('.fixedWeixinTemp').css('display','none');
			});
			
		})
		
		$('.fixedDownLoad').hover(function(){
			$(this).addClass('fixedDownLoadOver');
			$('.downLoadTemp').css('display','block');
			$('.downLoadTemp').animate({width:'170px'});
		},function(){
			$(this).removeClass('fixedDownLoadOver');
			$('.downLoadTemp').animate({width:'0px'},function(){
				$('.downLoadTemp').css('display','none');
			});
		})
		
		$('.gobackTop').hover(function(){
			$(this).addClass('gobackTopOver');
		},function(){
			$(this).removeClass('gobackTopOver');
		})
		
		$('.gobackNext').hover(function(){
			$(this).addClass('gobackNextOver');
		},function(){
			$(this).removeClass('gobackNextOver');
		})
		
		$('.gobackNext').click(function(){
			mySwiper.slideTo(mySwiper.activeIndex+1);
			process(mySwiper.activeIndex);
		})
		
		$('.gobackBacks').hover(function(){
			$(this).addClass('gobackBacksOver');
		},function(){
			$(this).removeClass('gobackBacksOver');
		})
		
		$('.gobackBacks').click(function(){
			mySwiper.slideTo(mySwiper.activeIndex-1);
			process(mySwiper.activeIndex);
		})
		//页脚弹窗
		$('.weixinkefu').hover(function(){
			$('.showWeixin').css('display','none');
			$('.showAcWeiXin').css('display','block');
		},function(){
			$('.showWeixin').css('display','block');
			$('.showAcWeiXin').css('display','none');
		})
		
		$('.weixinkefu').click(function(){
			$('.footWeiTemp').css('display','block');
		})
		
		$('.closeTemps').click(function(){
			$('.footWeiTemp').css('display','none');
		})
		
		$(".qualimg0").click(function(){
			$(".zizhitemp").css("display","block");
			$(".zizhitemps1").css("display","block");
		})
		
		$(".qualimg").click(function(){
			$(".zizhitemp").css("display","block");
			$(".zizhitemp1").css("display","block");
		})
		$(".qualimg2").click(function(){
			$(".zizhitemp").css("display","block");
			$(".zizhitemp2").css("display","block");
		})
		$(".qualimg3").click(function(){
			$(".zizhitemp").css("display","block");
			$(".zizhitemp4").css("display","block");
		})
		$(".qualimg4").click(function(){
			$(".zizhitemp").css("display","block");
			$(".zizhitemp3").css("display","block");
		})
		$(".qualimg5").click(function(){
			$(".zizhitemp").css("display","block");
			$(".zizhitemp5").css("display","block");
		})
		
		$(".zizhitemp").click(function(){
			$('.zizhitemp').css('display','none')
			$(".zizhitemps1").css("display","none");
			$(".zizhitemp1").css("display","none");
			$(".zizhitemp2").css("display","none");
			$(".zizhitemp3").css("display","none");
			$(".zizhitemp4").css("display","none");
			$(".zizhitemp5").css("display","none");
		})
		
		
})
